<?php
include_once("connexion.php");
if( isset($_POST["ok"])){
	$_SESSION['login'] = $_POST["nom"];
	$mdp = sha1($_POST["pass"]);
	
	$query = 'SELECT * FROM User WHERE login="'.$_POST['nom'].'"';
	$resultat = mysqli_query($bdd, $query);
	$user = mysqli_fetch_array($resultat);
	
	if($mdp == $user["Password"] && $user["id_spe"] == 0){
	     $_SESSION['co'] = "30";
	     $_SESSION['id'] = $user['Id'];
	     $_SESSION['nom'] = $user['Nom'];
	     echo "Vous êtes connecté ".$_SESSION['nom'];
	     
		}
	else if($mdp == $user["mdp"] && $user["id_spe"] == 1){
	     $_SESSION['co'] = "40";
	     $_SESSION['id'] = $user['Id'];
	     $_SESSION['nom'] = $user['Nom'];
	     echo "Vous êtes connecté ".$_SESSION['nom'];
	     
		}
	else if($mdp =! $user["mdp"]){
		echo "Mot de passe ou login invalide";
		}
	
	
}

?>

<! DOCTYPE html Public "http://www.w3.org/TTR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<link rel="stylesheet" type="text/css" href="style.css"/>

<title> Accueil </title>
<meta charset="UTF-8"    />
<meta http-equiv="content-type  content="charset=UTF-8"   />
  <title>jQuery UI Datepicker - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.9.1.js"></script>
  <script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">

 
</head>

<body>
<div id="banniere" ;   > 


</div  >

<br />


<div id = "menu" >

<a  href="index.php"/> Accueil </a>
<a  href="index2.php"/> Deposer annonce </a>
<a  href="Creation_user.php"/>  Inscription </a>
<a  href="acceuil"/> XXXX </a>




<form id="formulaire" method="post" action="Connexion_user.php">
Identification : 
<input type="text" id="nom" name="nom" value=""" />
Mot de passe :
<input type="password" id="pass" name="pass" value=""" />
<input type="submit" id="ok" name="ok" value="ok" />



</form>

</div>

<br />


<div id="barreinscription"  >
</div>

</br>






<div id ="footer" >
Copyright © 2003-2014 Concept Multimédia. Tous droits réservés. Les marques commerciales mentionnées appartiennent à leurs propriétaires respectifs.
L'utilisation de ce site Web implique l'acceptation des Conditions Générales d'Utilisation.
 
 
</div>


</body>

</html>